package ae.pcfc.cldos.online.common.facade.provider;

import java.util.ArrayList;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import ae.pcfc.cldos.online.common.facade.BaseFacade;
import ae.pcfc.cldos.online.common.facade.EmirateFacade;
import ae.pcfc.cldos.online.common.tscdb.domain.TTscEmirate;
import ae.pcfc.cldos.online.common.tscdb.domain.manager.TTscEmirateDOM;
import ae.pcfc.cldos.online.common.vo.selectors.EmirateVO;


/**
 * Facade implementation for getting a list of all emirates
 * @author ammar
 *
 */
public class EmirateFacadeImpl extends BaseFacade implements EmirateFacade {

	private TTscEmirateDOM tTscEmirateDOM;
	
	public void setTTscEmirateDOM(TTscEmirateDOM tTscEmirateDOM) {
		this.tTscEmirateDOM = tTscEmirateDOM;
	}
	@Transactional
	public List<EmirateVO> getEmiratesVOList() {
		List<TTscEmirate> emirateList = tTscEmirateDOM.getEmirateList();
		
		List<EmirateVO> result = new ArrayList<EmirateVO>(emirateList.size());
		
		for(TTscEmirate tscEmirate : emirateList){
			EmirateVO emirateVO = new EmirateVO();
			getMapper().map(tscEmirate, emirateVO);
			result.add(emirateVO);
		}
		
		return result;	
	}

}
